//
//  MLAShopFoodOrderStatusVC.m
//  MagicLampApp
//
//  Created by Zheng on 2019/4/9.
//  Copyright © 2019 zheng.magic.lamp.app. All rights reserved.
//

#import "MLAShopFoodOrderStatusVC.h"

@interface MLAShopFoodOrderStatusVC ()

@end

@implementation MLAShopFoodOrderStatusVC

- (void)backAction {
    if (self.navigationController.viewControllers.count > 1) {
        [self.navigationController popToViewController:self.navigationController.viewControllers[1] animated:YES];
    } else {
        [self.navigationController popViewControllerAnimated:YES];
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self configTitle:@"提交订单"];
    
    UIImageView *statusImgv = [[UIImageView alloc] init];
    [self.view addSubview:statusImgv];
    [statusImgv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleView.mas_bottom).offset(40);
        make.centerX.offset(0);
        make.width.height.offset(44);
    }];
    
    UILabel *titleLbl = [[UILabel alloc] init];
    titleLbl.font = CX_GetNormalFont(14);
    [self.view addSubview:titleLbl];
    [titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.offset(0);
        make.top.equalTo(statusImgv.mas_bottom).offset(18);
    }];
    
    UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBtn.titleLabel.font = CX_GetNormalFont(14);
    leftBtn.layer.cornerRadius = 5;
    leftBtn.layer.masksToBounds = YES;
    leftBtn.layer.borderWidth = 1;
    [leftBtn addTarget:self action:@selector(leftBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [leftBtn setTitle:@"返回首页" forState:UIControlStateNormal];
    [self.view addSubview:leftBtn];
    [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view.mas_centerX).offset(-20);
        make.top.equalTo(titleLbl.mas_bottom).offset(38);
        make.width.offset(100);
        make.height.offset(40);
    }];
    
    UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    rightBtn.titleLabel.font = CX_GetNormalFont(14);
    rightBtn.layer.cornerRadius = 5;
    rightBtn.layer.masksToBounds = YES;
    [rightBtn addTarget:self action:@selector(rightBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:rightBtn];
    [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_centerX).offset(20);
        make.top.equalTo(titleLbl.mas_bottom).offset(38);
        make.width.offset(100);
        make.height.offset(40);
    }];
    
    if (_isSuccess) {
        statusImgv.image = [UIImage imageNamed:@"f_sssss"];
        titleLbl.text = @"您的订单提交成功";
        titleLbl.textColor = CX_GetColorHex(0x3588EB, 1);
        [leftBtn setTitleColor:CX_GetColorBlue() forState:UIControlStateNormal];
        leftBtn.layer.borderColor = CX_GetColorBlue().CGColor;
        
        [rightBtn setTitle:@"查看订单" forState:UIControlStateNormal];
        rightBtn.backgroundColor = CX_GetColorBlue();
    } else {
        statusImgv.image = [UIImage imageNamed:@"f_fffff"];
        titleLbl.text = @"您的订单提交失败";
        titleLbl.textColor = CX_GetColorHex(0xF45D3F, 1);
        [leftBtn setTitleColor:CX_GetColorHex(0xF45D3F, 1) forState:UIControlStateNormal];
        leftBtn.layer.borderColor = CX_GetColorHex(0xF45D3F, 1).CGColor;
        
        [rightBtn setTitle:@"重新提交" forState:UIControlStateNormal];
        rightBtn.backgroundColor = CX_GetColorHex(0xF45D3F, 1);
        
    }


}


- (void)leftBtnAction {
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)rightBtnAction {
    if (_isSuccess) {

    } else {

    }
}


@end
